package com.qxzn.app.api.util;

import org.greenrobot.eventbus.EventBus;


/**
 * 功能：EventBus操作类
 */
public class EventBusManager {

    //订阅
    public static void register(Object object) {
        if (!EventBus.getDefault().isRegistered(object)) {
            EventBus.getDefault().register(object);
        }
    }

    //取消订阅
    public static void unregister(Object object) {
        if (EventBus.getDefault().isRegistered(object)) {
            EventBus.getDefault().unregister(object);
        }
    }

    //发送消息
    public static void post(Object obj) {
        EventBus.getDefault().postSticky(obj);
    }
}
